fix: search_code returns not indexed even when VectorDB has data (#226)#283
Merged
zc277584121 merged 2 commits intozilliztech:masterfrom Mar 12, 2026
Merged
Conversation
…pshot Add recentlyRemoved Set to SnapshotManager to track codebases that were explicitly removed via removeCodebaseCompletely(). The mergeExternalEntry() method now checks this set and skips re-adding entries from disk that were intentionally removed. The set is cleared after each successful save. This fixes a bug where the read-merge-write pattern in saveCodebaseSnapshot() would read old disk data and merge back entries that had just been removed from memory, causing removed codebases to reappear in the snapshot. Signed-off-by: Cheney Zhang <chen.zhang@zilliz.com>
…liztech#226) Four changes to fix search_code false negatives caused by snapshot losing track of indexed codebases: 1. Bidirectional cloud sync: recover cloud codebases missing from local snapshot during syncIndexedCodebasesFromCloud(), instead of skipping them. 2. Search VectorDB fallback: when snapshot says not indexed, check VectorDB directly before returning error. If VectorDB has the index, recover the snapshot entry and continue with search. 3. Fix empty filter in sync query: pass undefined instead of empty string to vectorDb.query() to avoid failures on local Milvus. 4. Index mismatch auto-repair: when snapshot and VectorDB disagree during index_codebase, auto-fix by either recovering or clearing the snapshot entry, instead of just logging a warning. Signed-off-by: Cheney Zhang <chen.zhang@zilliz.com>
This was referenced Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
recentlyRemovedSet toSnapshotManagerto preventmergeExternalEntry()from re-adding codebases that were just removed viaremoveCodebaseCompletely()during the save's read-merge-write cycle.handlers.ts:''→undefined)Root Cause
The snapshot file is the sole arbiter of whether a codebase is indexed, but it can lose entries due to:
When the snapshot loses track,
search_codereturns "not indexed" even though VectorDB has perfectly valid index data.Fix Approach
Make VectorDB the source of truth by adding fallback checks at every code path:
Test Plan
Closes #226